<template>
  <!-- 提示信息 -->
  <div class="g-buddy__info">
    <!-- 组件 -->
    <div class="buddy__center">
      <div class="buddy__row">
        <UserInfo :user="user" />
      </div>
      <slot name="center" :user="user">
        <div class="buddy__row">
          <div class="remark buddy__item">
            <span>备注</span>
            <span v-text="user?.remark"></span>
          </div>
          <div class="label buddy__item">
            <span>标签</span>
            <span v-text="user?.label"></span>
          </div>
        </div>
        <div class="buddy__row">
          <div class="signature buddy__item">
            <span>共同群聊</span>
            <span v-text="user?.signature"></span>
          </div>
          <div class="origin buddy__item">
            <span>来源</span>
            <span v-text="user?.origin"></span>
          </div>
        </div>
      </slot>
      <slot name="footer" :user="user">
        <div class="buddy__row buddy__footer">
          <div class="buddy__line">
            <Icon use="xiaoxi1" size="2em" color="#859fd3" />
            <span>发消息</span>
          </div>

          <div class="buddy__line">
            <Icon use="dianhua" size="2em" color="#859fd3" />
            <span>语音聊天</span>
          </div>

          <div class="buddy__line">
            <Icon use="video1" size="2em" color="#859fd3" />
            <span>视频聊天</span>
          </div>
        </div>
      </slot>
    </div>
    <!-- <button>发消息</button> -->
    <div class="g-buddy__fiexd" @click="fixedEvent">
    </div>
  </div>
</template>

<script setup>
import UserInfo from '@/components/UserInfo/Index.vue';
import Icon from '@/components/SVG/index.vue';
import { ref } from 'vue';

const emits = defineEmits("fixedEvent")

const { user } = defineProps({
  user: {
    type: Object,
    required: true,
  }
})

function fixedEvent (e) {
  emits("fixedEvent", e)
}


</script>

<style lang="scss" scoped>
.g-buddy__info {
  position: absolute;
  left: 100%;
  min-width: 260px;
  border-radius: 2px;
  z-index: $index;
  top: 10px;
  padding: 10px 20px;
  background-color: white;
  box-shadow: 1px 1px 1px 1px $shadow-border, -1px -1px 1px 1px $shadow-border;

  .buddy__row {
    padding: 14px 20px;

    &:not(:nth-child(1)) {
      border-top: 1px solid #ccc;

    }

    .buddy__item {
      display: flex;
      gap: 18px;
      // margin: 6px 0;
      font-size: 14px;

      >span {
        margin: 4px 0;

        &:nth-child(1) {
          min-width: 60px;
          text-align: left;
          color: #bbb;
        }
      }
    }

    .buddy__line {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 10px;
      color: #859fd3;
      padding: 6px 20px;
      white-space: nowrap;
      // background-color: red;

      &:hover {
        background-color: #ccc;
      }


    }
  }

  .buddy__footer {
    display: flex;
    align-items: center;
    // gap: 10px;
    justify-content: flex-end;
    font-size: 12px;
  }
}

.g-buddy__fiexd {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}
</style>